SPB Git

Repository Public

page.tsx 6.5 KB 130 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Valo-Plex8 * File             : src/app/marche/[slug]/page.tsx9 * Module           : app10 * Repository       : https://git.spboucher.ai/valo-plex11 * Project Website  : https://www.valo-plex.com12 * Created          : 2026-12-0113 * Last Modified    : 2026-12-0114 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import type { Metadata } from "next";44import Link from "next/link";45import { notFound } from "next/navigation";46import { Courbe } from "@/components/Courbe";47import { CLASSES, dollars, grand, GROUPES, nombre, pct } from "@/lib/format";48import { marcheRevenuRegion, serie, territoire, territoires } from "@/lib/requetes";4950export const dynamic = "force-dynamic";51type Props = { params: Promise<{ slug: string }> };5253export async function generateMetadata({ params }: Props): Promise<Metadata> {54  const { slug } = await params;55  const r = territoire("region", slug);56  if (!r) return { title: "Région introuvable" };57  return { title: `Plex en ${r.nom} : prix par porte, valeurs, taux de capitalisation`, description: `Marché des plex de la région ${r.nom} : ${r.immeubles} immeubles évalués, prix payé par porte, loyers et taux de capitalisation.`, alternates: { canonical: `/marche/${r.slug}` } };58}5960export default async function Region({ params }: Props) {61  const { slug } = await params;62  const r = territoire("region", slug.slice(0, 80));63  if (!r) notFound();64  const villes = territoires("municipalite", r.code).slice(0, 60);65  const revenu = marcheRevenuRegion(Number(r.code));66  const classes = JSON.parse(r.classes) as Record<string, { n: number; valeur_mediane: number | null; porte_mediane: number | null }>;67  return (68    <section className="section">69      <div className="cadre">70        <nav className="fil" aria-label="Fil d'Ariane"><Link href="/marche">Marché</Link> / {r.nom}</nav>71        <span className="etiquette">Région · {r.nom}</span>72        <h1>Les plex de {r.nom}.</h1>73        <div className="chiffres">74          <div className="chiffre"><b>{nombre(r.immeubles)}</b><span>immeubles, {nombre(r.portes)} portes</span></div>75          <div className="chiffre"><b>{dollars(r.valeur_mediane)}</b><span>valeur médiane d'un immeuble</span></div>76          <div className="chiffre"><b>{dollars(r.prix_porte_12m)}</b><span>prix payé par porte, 12 mois ({nombre(r.ventes_12m)} ventes)</span></div>77          <div className="chiffre"><b>{grand(r.valeur_totale)}</b><span>valeur estimée du parc</span></div>78        </div>79        <div style={{ marginTop: 36 }}>80          <Courbe points={serie("region", r.code)} titre={`Prix médian payé par porte, ventes de marché de plex, par trimestre, ${r.nom}`} />81        </div>82        <div className="deux" style={{ marginTop: 44 }}>83          <div>84            <h2 style={{ marginBottom: 14 }}>Par type</h2>85            <div className="table-defile">86              <table>87                <thead><tr><th>Type</th><th>Immeubles</th><th>Valeur médiane</th><th>Par porte</th></tr></thead>88                <tbody>89                  {Object.keys(CLASSES).filter((c) => classes[c]).map((c) => (90                    <tr key={c}><td>{CLASSES[c]}</td><td className="mono">{nombre(classes[c].n)}</td><td className="mono">{dollars(classes[c].valeur_mediane)}</td><td className="mono">{dollars(classes[c].porte_mediane)}</td></tr>91                  ))}92                </tbody>93              </table>94            </div>95          </div>96          <div>97            <h2 style={{ marginBottom: 14 }}>Rendements implicites</h2>98            <div className="table-defile">99              <table>100                <thead><tr><th>Taille</th><th>Ventes</th><th>Taux de capitalisation</th><th>Multiplicateur</th></tr></thead>101                <tbody>102                  {revenu.map((l) => (103                    <tr key={l.groupe}><td>{GROUPES[l.groupe]}</td><td className="mono">{nombre(l.n)}</td><td className="mono">{pct(l.tga, 2)}</td><td className="mono">{nombre(l.mrb, 1)}</td></tr>104                  ))}105                </tbody>106              </table>107            </div>108            <p className="note">Ventes des 18 derniers mois. Sous 20 ventes, le taux est tiré vers celui de la province pour la même taille.</p>109          </div>110        </div>111        <h2 style={{ margin: "48px 0 16px" }}>Par municipalité</h2>112        <div className="table-defile">113          <table>114            <thead><tr><th>Municipalité</th><th>Immeubles</th><th>Valeur médiane</th><th>Valeur par porte</th><th>Loyer de marché</th><th>Ventes, 12 mois</th><th>Prix payé par porte</th></tr></thead>115            <tbody>116              {villes.map((v) => (117                <tr key={v.code}>118                  <td><Link href={`/ville/${v.code}`}>{v.nom}</Link></td><td className="mono">{nombre(v.immeubles)}</td><td className="mono">{dollars(v.valeur_mediane)}</td><td className="mono">{dollars(v.porte_mediane)}</td>119                  <td className="mono">{dollars(v.loyer_median)}</td><td className="mono">{nombre(v.ventes_12m)}</td><td className="mono">{dollars(v.prix_porte_12m)}</td>120                </tr>121              ))}122            </tbody>123          </table>124        </div>125        <p style={{ marginTop: 22 }}><Link className="bouton clair" href={`/a-vendre?region=${r.code}`}>Plex à vendre en {r.nom}</Link></p>126      </div>127    </section>128  );129}130
Files main
Menu

Theme